import React, { Component } from "react";
import DouyinDetail from "../../pages/DouyinDetail/DouyinDetail";
import DouyinList from "../../pages/DouyinList/DouyinList";
import {Route} from 'react-router-dom';
//1. 导入 withRouter 函数   作用: 将一般组件包裹称为路由组件
import {withRouter} from 'react-router-dom';

class Douyin extends Component {
    render() {
        return (
            <>
                <div className="nav" style={{padding: '20px'}}>
                    <button className="btn btn-danger" onClick={this.douyin}>抖音</button>
                </div>
                <Route path="/douyin" component={DouyinList} />
                <Route path="/play" component={DouyinDetail} />
            </>
        );
    }

    douyin = () => {
        this.props.history.push('/douyin');
    }

    componentDidMount(){
        // console.log(window.location); 
    }
}

//2. 暴露
export default withRouter(Douyin);


/**
 * 
 *  app.get('/video/:id', (req, res) => {
 *      
 *  })
 * 
 */